<?php
/**
 * 
 * Enter description here ...
 * @author Administrator
 * @return Dwz_PageContent内容	
 *
 */
class Control_dwz_dgContent extends QUI_Control_Abstract
{
	/**
	 * 
	 * @access array(array('_ui'=>'li','_label'=>'test','_attrs'=>array('target'=>'selectedTodo')))
	 * @var array()
	 */
	protected $pageToolBars = NULL;
	/**
	 * 
	 * @access 传入array($key=>$val)字符串数组
	 * @var Array
	 */
	protected $thead_title = array();
	/**
	 * 
	 * @access 绑定Table数据
	 * @var QDB_ActiveRecord_Abstract
	 */
	protected $adapter_data ;
	function render()
	{
		$this->pageToolBars = $this->get('pageToolBars');
		$this->thead_title = $this->get('thead_title');
		$this->adapter_data = $this->get('adapter');
		
		if (count($this->thead_title) == 0)
		{
			return '标题未设置';
		}else
		{
			$out = '<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">';
			//pageBars
			
			foreach ($this->pageToolBars as $k=>$v)
			{
				
				$out.= Q::control('dwz_dwztoolBar','toolba_'.$k,$v);
			}
			$out.= '</ul>
	</div>';
			
			//tables
			$out.='	<table class="table" width="1200" layoutH="138">
		<thead>
			<tr>
				<th width="10%"><input type="checkbox" group="id" class="checkboxCtrl"></th>';
			$width_div = abs(90/count($this->thead_title)); 
			foreach ($this->thead_title as $k=>$v)
			{
				$out.= "<th width=\"{$width_div}%\" orderField=\"{$k}\">{$v}</th>";
			}
			$out.= '</tr>
		</thead>';
			//bind_adapter_data
			$out.= '<tbody>';
			foreach ($this->adapter_data as $k=>$v)
			{
				$out.= '<tr target="id" rel="'. $v->id .'">';
				$out.= '<td><input name="id" value="' . $v->id  . '" type="checkbox"></td>';
				foreach ($this->thead_title as $kk=>$vv)
				{
					$out.= "<td>{$v->$kk}</td>";
				}
			}
			$out.='</tbody>
	</table>';
		}
		return $out;
	}
	
}
?>